<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scale">
    <title>轮播插件</title>
    <link rel="stylesheet" href="css/bootstrap.min.css"/>
    <script src="js/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <style>
        #myCarousel{
            width: 735px;
        }
        a{
            line-height: 350px;
            /*background: none !important;*/
        }
    </style>
</head>
<body style="">
<!--自动轮播  data-ride="carousel" -->
<div id="myCarousel" class="carousel slide">
    <ol class="carousel-indicators">
        <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
        <li data-target="#myCarousel" data-slide-to="1"></li>
        <li data-target="#myCarousel" data-slide-to="2"></li>
    </ol>
    <div class="carousel-inner">
        <div class="item active">
            <img src="img/3.jpg" alt="第一张"/>
        </div>
        <div class="item">
            <img src="img/4.jpg" alt="第二张"/>
        </div>
        <div class="item">
            <img src="img/5.jpg" alt="第三张"/>
        </div>
    </div>
    <a href="#myCarousel" data-slide="prev" class="carousel-control left">&lsaquo;</a>
    <a href="#myCarousel" data-slide="next" class="carousel-control right">&rsaquo;</a>
</div>

<button class="btn btn-default" id="cycle">开始</button>
<button class="btn btn-default" id="pause">停止</button>
<button class="btn btn-default" id="number">播放第三条</button>
<button class="btn btn-default" id="prev">上一个</button>
<button class="btn btn-default" id="next">下一个</button>
<script>
    /*
    $('#myCarousel').carousel({
        interval:2000   //轮播速度2s
    });
    */
    /*
    $('#cycle').on('click',function(){
        $('#myCarousel').carousel('cycle');
    });

    $('#pause').on('click',function(){
        $('#myCarousel').carousel('pause');
    });

    $('#number').on('click',function(){
        $('#myCarousel').carousel(2);
    });

    $('#prev').on('click',function(){
        $('#myCarousel').carousel('prev');
    });

    $('#next').on('click',function(){
        $('#myCarousel').carousel('next');
    });

    $('#myCarousel').on('slide.bs.carousel',function(){
        alert('执行之前调用');
    });

    $('#myCarousel').on('slid.bs.carousel',function(){
        alert('执行完毕后调用');
    });
    */
</script>
</body>

</html>